<?php

namespace App\Admin\Extensions;

use App\Model\UserAutoMsg;
use Encore\Admin\Admin;

/**
 * 打招呼消息
 */
class AutoMsgOp extends BaseAction
{
    protected function render()
    {
        Admin::script($this->script($this->actionUrl));
        $notbtn = $this->buildButton('fail', '不通过', ['id' => $this->id, 'status' => UserAutoMsg::STATUS_FAIL]);
        $okbtn = $this->buildButton('ok', '通过', ['id' => $this->id, 'status' => UserAutoMsg::STATUS_OK]);
        if ($this->row->flag == UserAutoMsg::STATUS_OK) $str = [$notbtn];
        elseif ($this->row->flag == UserAutoMsg::STATUS_DEL) $str = [];
        else $str = [$okbtn, $notbtn];
        return implode('<br/><br/>', $str);
    }
}
